package com.shop.user.controller;

import com.shop.entity.dto.WeChatAddress.UserAddressGetUpdateDto;
import com.shop.entity.dto.WeChatAddress.UserAddressRemoveDto;
import com.shop.entity.dto.WeChatAddress.UserAddressSaveDto;
import com.shop.entity.dto.WeChatAddress.UserAddressUpdateDto;
import com.shop.user.service.AddressService;
import com.shop.utils.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/address")
public class AddressController {

    @Autowired
    private AddressService addressService;

    @GetMapping("/get_user_address_list")
    public Result getUserAddressList(){
        return addressService.getUserAddressList();
    }

    @PostMapping("/save_user_address")
    public Result saveUserAddress(@RequestBody UserAddressSaveDto dto){
        return addressService.saveUserAddress(dto);
    }

    @PostMapping("/remove_user_address")
    public Result removeUserAddress(@RequestBody UserAddressRemoveDto dto){
        return addressService.removeUserAddress(dto);
    }

    @PostMapping("/get_update_user_address")
    public Result getUpdateUserAddress(@RequestBody UserAddressGetUpdateDto dto){
        return addressService.getUpdateUserAddress(dto);
    }

    @PostMapping("update_user_address")
    public Result updateUserAddress(@RequestBody UserAddressUpdateDto dto){
        return addressService.updateUserAddress(dto);
    }

}
